package parallelism;

import java.util.concurrent.Callable;

import optimizers.simplega.Individual;

public class SGAIndividualFitnessEvaluationTask implements Callable {
	private int index;
	private Individual indiv;

	public SGAIndividualFitnessEvaluationTask(int i, Individual indiv) {
		this.index = i;
		this.indiv = indiv;
	}

	public Object call() {
		long startTime = System.currentTimeMillis();
		fitness.FitnessResult result = null;
		indiv.evaluateFitness();
		double estimatedTime = ((double) System.currentTimeMillis() - startTime) / 1000;
		return new SystemFitnessResult(index, result, estimatedTime);
	}
}